package cn.edu.baiyunu.myapplication.ui.history

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import cn.edu.baiyunu.myapplication.data.repository.PhotoRepository

/**
 * HistoryViewModel工厂，用于创建HistoryViewModel实例
 */
class HistoryViewModelFactory(
    private val photoRepository: PhotoRepository
) : ViewModelProvider.Factory {
    
    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        if (modelClass.isAssignableFrom(HistoryViewModel::class.java)) {
            return HistoryViewModel(photoRepository) as T
        }
        throw IllegalArgumentException("Unknown ViewModel class")
    }
} 